package com.search.common.dto.client;

import com.search.common.dto.MyFeignInterceptor;
import com.search.common.dto.PageDTO;
import com.search.common.dto.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "itemservice",configuration = MyFeignInterceptor.class) //你要远程调用的服务的名称（注册中心服务的名称）
public interface ItemClient {
    /**
     * 请求方式一致 GET
     * 请求路径一致 完整路径=类上的路径+方法上的路径
     * 请求参数一致
     * 响应结果一致
     */
    @GetMapping("/item/list")
    public PageDTO<Item> queryById(@RequestParam("page") Integer page, @RequestParam("size") Integer size);
    @GetMapping("/item/{id}")
    public Item getById(@PathVariable long id);
    @PutMapping("/stock/{itemId}/{num}")
    public void UpStock(@PathVariable(value = "itemId") long itemId,@PathVariable(value = "num") Integer num);
}
